Class sjl.Map
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sjl.Map

java.lang.Object
   |
   +----java.util.Dictionary
           |
           +----sjl.Map

public class Map
extends Dictionary
implements AssociativeContainer, ReversibleContainer
Map is a kind of associative container that supports unique keys (contains at most one of each key value) and provides for fast retrieval of another object based on the keys.

Copyright © 1996 Finn Bock


Constructor Index

 o Map(InputIterator, InputIterator, Predicate2)
Construct a map and initialize it with the elements in the range [first,last).
 o Map(Map)
Construct a map and initialize it with the contents of another map.
 o Map(Predicate2)
Construct an empty map.

Method Index

 o begin()
Returns the iterator that represents the beginning of the map.
 o beginGeneric()
Returns the iterator that represents the beginning of the map as an untyped iterator.
 o beginRef()
Returns a reference to the iterator that represents the beginning of the map.
 o count(Object)
Returns the number of element with a key equal to value.
 o elements()
From Dictionary; Returns an enumeration of the elements.
 o empty()
Returns true if the map does not contain any elements.
 o end()
Returns the iterator that represents the end of the map.
 o endGeneric()
Returns the iterator that represents the end of the map as an untyped iterator.
 o endRef()
Returns a reference to the iterator that represents the end of the map.
 o equal_range(Object)
Returns a pair like Pair(lower_bound(value), upper_bound(value)).
 o equals(Object)
Compare the elements in this container with the elements in another container.
 o erase(Iterator)
Erase the element pointed to by the iterator.
 o erase(Iterator, Iterator)
Erase the elements in the range [first,last).
 o erase(Object)
Erase the element with key equal to value.
 o find(Object)
Search the map for an element with a key equal to value.
 o flush()
Erase all the elements in the container.
 o get(Object)
Retrives the value associated with the key.
 o insert(InputIterator, InputIterator)
Insert the elements from the range [first,last) into the map.
 o insert(Iterator, Pair)
Insert an element into the map.
 o insert(Pair)
Insert an element into the map.
 o isEmpty()
From Dictionary; Returns true if the map contains no elements.
 o keys()
From Dictionary; Returns an enumeration of the Map's keys.
 o lower_bound(Object)
Returns an iterator pointing to the first element with a key not less than value.
 o max_size()
Returns the maximum number of elements allowed in a map.
 o put(Object, Object)
Insert the key-value objects into the map.
 o rbegin()
Returns a copy of the reverse iterator that represents the beginning (end) of the list.
 o rbeginGeneric()
Returns a copy of the reverse iterator that represents the beginning (end) of the list as an untyped Iterator.
 o remove(Object)
From Dictionary; Removes the element corresponding to the key.
 o rend()
Returns a copy of the iterator that represents the end (beginning) of the list.
 o rendGeneric()
Returns a copy of the iterator that represents the end (beginning) of the list as an untyped Iterator.
 o size()
Returns the number of elements in the map.
 o upper_bound(Object)
Returns an iterator pointing to the first element with a key greter than value.

Constructors

 o Map
  public Map(Predicate2 predicate)
Construct an empty map.
Parameters:
predicate - Use predicate as the comparison object.
 o Map
  public Map(Map map)
Construct a map and initialize it with the contents of another map.
Parameters:
map - Initialize the new map with the elements of map.
 o Map
  public Map(InputIterator first,
             InputIterator last,
             Predicate2 predicate)
Construct a map and initialize it with the elements in the range [first,last).
Parameters:
first - The beginning of the range.
last - The end of the range.
predicate - Use predicate as the comparison object.

Methods

 o flush
  public void flush()
Erase all the elements in the container.
 o equals
  public boolean equals(Object container)
Compare the elements in this container with the elements in another container.
Returns:
true is the elements match.
Overrides:
equals in class Object
 o begin
  public BidirectionalIterator begin()
Returns the iterator that represents the beginning of the map.
 o beginRef
  public BidirectionalIterator beginRef()
Returns a reference to the iterator that represents the beginning of the map.
 o end
  public BidirectionalIterator end()
Returns the iterator that represents the end of the map.
 o endRef
  public BidirectionalIterator endRef()
Returns a reference to the iterator that represents the end of the map.
 o beginGeneric
  public ForwardIterator beginGeneric()
Returns the iterator that represents the beginning of the map as an untyped iterator.
 o endGeneric
  public ForwardIterator endGeneric()
Returns the iterator that represents the end of the map as an untyped iterator.
 o rbegin
  public ReverseBidirectionalIterator rbegin()
Returns a copy of the reverse iterator that represents the beginning (end) of the list.
 o rend
  public ReverseBidirectionalIterator rend()
Returns a copy of the iterator that represents the end (beginning) of the list.
 o rbeginGeneric
  public Iterator rbeginGeneric()
Returns a copy of the reverse iterator that represents the beginning (end) of the list as an untyped Iterator.
 o rendGeneric
  public Iterator rendGeneric()
Returns a copy of the iterator that represents the end (beginning) of the list as an untyped Iterator.
 o size
  public int size()
Returns the number of elements in the map.
Overrides:
size in class Dictionary
 o max_size
  public int max_size()
Returns the maximum number of elements allowed in a map.
 o empty
  public boolean empty()
Returns true if the map does not contain any elements.
 o insert
  public Pair insert(Pair value)
Insert an element into the map. The element is only inserted if there is no element in the container with a key equal to the key of value.
Parameters:
value - The element to insert.
Returns:
The first component of pair is an iterator that point to the element with a key equal to the key of value. The second component of pair is a Boolean that is true if value was actually inserted, and false if the container already contained a element equal to value.
 o insert
  public ForwardIterator insert(Iterator position,
                                Pair value)
Insert an element into the map. The element is only inserted if there is no element in the container with a key equal to the key of value.
Parameters:
position - A hint pointing to where the insert should start to search. If the hint is correct, and the value is inserted right after position, the time is amortized constant.
value - The element to insert.
Returns:
The an iterator that point to the element with a key equal to the key of value
 o insert
  public void insert(InputIterator first,
                     InputIterator last)
Insert the elements from the range [first,last) into the map.
Parameters:
first - The beginning of the range.
last - The end of the range.
 o erase
  public void erase(Iterator position)
Erase the element pointed to by the iterator.
Parameters:
position - Points to the element to be removed.
 o erase
  public int erase(Object value)
Erase the element with key equal to value.
Returns:
The number of element erased.
 o erase
  public void erase(Iterator first,
                    Iterator last)
Erase the elements in the range [first,last).
Parameters:
first - The beginning of the range.
last - The end of the range.
 o find
  public ForwardIterator find(Object key)
Search the map for an element with a key equal to value.
Parameters:
key - The key to search for.
Returns:
An Iterator pointing to the element with a key equal to value, or end() if such an element is not found.
 o get
  public Object get(Object key)
Retrives the value associated with the key.
Parameters:
key - The key to search for.
Returns:
The value object associated with the key, or null of the key does not exist in the map.
Overrides:
get in class Dictionary
 o put
  public Object put(Object key,
                    Object value)
Insert the key-value objects into the map. The objects is inserted into the map as a pair. If the map already contains such a key, the value specified replces the existing value.
Parameters:
key - The key to search for.
key - The value to be inserted.
Overrides:
put in class Dictionary
 o count
  public int count(Object value)
Returns the number of element with a key equal to value.
 o lower_bound
  public RBtreeIterator lower_bound(Object value)
Returns an iterator pointing to the first element with a key not less than value.
 o upper_bound
  public RBtreeIterator upper_bound(Object value)
Returns an iterator pointing to the first element with a key greter than value.
 o equal_range
  public Pair equal_range(Object value)
Returns a pair like Pair(lower_bound(value), upper_bound(value)).
 o isEmpty
  public boolean isEmpty()
From Dictionary; Returns true if the map contains no elements.
Returns:
true of the Map contains no elements.
Overrides:
isEmpty in class Dictionary
 o keys
  public Enumeration keys()
From Dictionary; Returns an enumeration of the Map's keys.
Overrides:
keys in class Dictionary
 o elements
  public Enumeration elements()
From Dictionary; Returns an enumeration of the elements. Use the Enumeration methods on the returned object to fetch the elements sequentially.
Overrides:
elements in class Dictionary
 o remove
  public Object remove(Object key)
From Dictionary; Removes the element corresponding to the key. Does nothing if not present.
Parameters:
key - the key that needs to be removed.
Returns:
the value of the key, or null if the key was not found.
Overrides:
remove in class Dictionary

All Packages  Class Hierarchy  This Package  Previous  Next  Index